package com.witmed.mymdm.ui.home

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.witmed.lib_base.BaseViewModel
import com.witmed.mymdm.R

class HomeViewModel : BaseViewModel<HomeResp,HomeState>() {
    val icons= arrayOf(R.drawable.ic_launcher_background,R.drawable.ic_launcher_background,R.drawable.ic_launcher_background,R.drawable.ic_launcher_background,
        R.drawable.ic_launcher_background,R.drawable.ic_launcher_background,R.drawable.ic_launcher_background)
    val titles= arrayOf("在线应用","本地应用","考勤打卡","智能审批","工作日志","任务","文件")
    val paths= arrayOf("","","","","","","")

    val iconIms= arrayOf(R.drawable.ic_launcher_background,R.drawable.ic_launcher_background,R.drawable.ic_launcher_background)
    val titleIms= arrayOf("联系人","讨论组","组织架构")
    val pathIms= arrayOf("","","")

    fun createData() {
        val list = ArrayList<HomeEntity>()
        list.add(HomeEntity("应用",R.drawable.ic_home_black_24dp,"",1))
        for (i in 0..icons.size-1){
            list.add(HomeEntity(titles[i],icons[i],paths[i],2))
        }
        list.add(HomeEntity("通信",R.drawable.ic_home_black_24dp,"",1))
        for (i in 0..iconIms.size-1){
            list.add(HomeEntity(titleIms[i],iconIms[i],pathIms[i],2))
        }
        list.add(HomeEntity("公众号",R.drawable.ic_home_black_24dp,"",1))
        list.add(HomeEntity("知识中心",R.drawable.ic_home_black_24dp,"",1))
        mutableContainer.updateUiState { copy(list = list) }
    }

    override fun createState(): HomeState {
        return HomeState(ArrayList<HomeEntity>())
    }

    override fun createResp(): HomeResp {
        return HomeResp()
    }
}